<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>订单管理-车速递</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/mymain.mymain.css">
    <script type="application/javascript" src="../js/jquery-3.3.1.js"></script>
    <script type="application/javascript" src="../js/bootstrap.min.js"></script>
    <script type="application/javascript" src="../layui/layui.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script src="../js/vue.min.js"></script>

</head>
<body style="position: static">

<div id="app" class="bgGray">
    <div data-v-95ac8d30="" class="header3" id="header">
        <div data-v-95ac8d30="" class="layout clear">
            <div data-v-95ac8d30="" class="left logo">
                <a data-v-95ac8d30="" href="/">
                    <img data-v-95ac8d30=""
                         src="">
                </a>
            </div>
            <div data-v-95ac8d30="" class="header3Nav right">|<a data-v-95ac8d30="" href="/mymain/mymain.html">我的订单</a>|<a
                    data-v-95ac8d30="" href="helpCenter.html">帮助中心</a>|<a data-v-95ac8d30=""
                                                                          href="/pagehome/login.html"
                                                                          onclick="logout()">退出</a>
            </div>
            <div data-v-95ac8d30="" class="header3User right">
                <i data-v-95ac8d30="" class="iconfont icon-phone"></i>
                <span data-v-95ac8d30="" class="sp1">400-919-8000</span>
                <span data-v-95ac8d30="" class="sp2">欢迎您，{{ tel }}</span>
                <span data-v-95ac8d30="" class="sp3"></span>
            </div>
        </div>
    </div>
    <div class="userInfo">
        <div class="layout">
            <div class="userInfoCom clear">
                <div class="userInfoL left">
                    <div data-v-1cae2c34="" class="userNav">
                        <dl data-v-1cae2c34="" class="userMsg">
                            <dt data-v-1cae2c34="">
                                <img data-v-1cae2c34=""
                                     src="">
                            </dt>
                            <dd data-v-1cae2c34="">
                                <p data-v-1cae2c34=""></p>
                                <p data-v-1cae2c34="" class="p5 pp" style="">普卡会员</p>
                            </dd>
                        </dl>
                        <ul data-v-1cae2c34="" class="manNav">
                            <li data-v-1cae2c34="">
                                <a data-v-1cae2c34="" href="mymain.html" class="sel">订单管理</a>
                            </li>
                            <li data-v-1cae2c34="">
                                <a data-v-1cae2c34="" href="myinfo.html" class="">个人信息</a>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="userInfoR right">

                    <div class="orderManage manage">
                        <div class="orderManageTit manageTit clear">
                            <div class="left tit">订单管理</div>
                        </div>
                        <div class="orderType clear type">
                            <div class="sel">全部订单</div>
                        </div>
                        <div class="orderList list">
                            <div class="orderListCom listCom" style="position: static;">
                                <table cellspacing="0" cellpadding="0">
                                    <tr class="firstTr">
                                        <th>订单号</th>
                                        <th>订单金额</th>
                                        <th>车型</th>
                                        <th>取车地址</th>
                                        <th>还车地址</th>
                                        <th>订单状态</th>
                                        <th>操作</th>
                                    </tr>
                                </table>
                                <div class="noData" id="noda">

                                    <table cellspacing="0" cellpadding="0">
                                        <tr class="firstTr" v-for="site in obj">
                                            <td>{{site.oid}}</td>
                                            <td>{{site.oprice}}</td>
                                            <td>{{site.cname}}</td>
                                            <td>{{site.getcity}}</td>
                                            <td>{{site.backcity}}</td>
                                            <td>{{site.ostatus}}</td>
                                            <td><a  href="javascript:void(0)" style="color:red" @click="delOrder(site.oid)">删除</a></td>
                                        </tr>
                                    </table>


                                    <div id="fenye"></div>

                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div data-v-3aaf9db2="" class="footer2">
        <div data-v-3aaf9db2="" class="layout clear">
            <div data-v-3aaf9db2="" class="d1">
                <a data-v-3aaf9db2="" href="about.html">关于车速递</a></div>
        </div>
    </div>

</div>

<script>
    function logout() {
        $.ajax({
            type: "get",
            url: "/logout",
            dataType: "json",
            success: function (data) {
                localStorage.clear();
                window.location.href = "/pagehome/login.html";
            },
            error: function () {
                alert("退出登录失败");
            }
        })
    }
</script>

<script type="text/javascript">
    var totalCount;
    var all = new Vue({
        el: '#noda',
        data: {
            obj: [],
        },
        methods:{
            /*删除订单*/
           delOrder:function (oid) {

               //alert(oid);
                alert("删除");
                $.ajax({
                    url:'/order/delById?id='+oid,
                    type:'get',
                    dataType:'json',
                    success:function (data) {

                        alert("删除成功");
                        loadData();

                    }

                })

            }
        }
    });
    var vm1 = new Vue({
        el: "#header",
        data: {
            tel: ""
        }
    });
    $(function () {
        /*
        * 获取localStorage中的用户信息
        * */
        var user = JSON.parse(localStorage.getItem("user"));
        vm1.tel = user.tel;
    });

    /*订单模块*/
    $(function () {
        loadData();
    });

    function loadData() {
        $.ajax({
            type: "get",
            url: "/order/selectAll?page=1" ,
            dataType: "json",
            /*async: false,*/
            success: function (data) {
                //alert(data);
                //id为0时为父类
                if (data.statusCode == 200) {
                    /*totalCount = data.info.total;*/
                    all.obj = data.data;
                } else {
                    alert(data.data);
                }
            },
            error: function () {
                alert("ajax加载错误");
            }
        });
    }


   /* layui.use(['laypage', 'layer'], function () {
        var laypage = layui.laypage
            , layer = layui.layer;

        //总页数大于页码总数
        laypage.render({
            elem: 'fenye'
            , count: totalCount //数据总数
            , limit: 5
            , jump: function (obj, first) {
                /!*console.log(obj)*!/
                var currentPage = obj.curr;

                // loadData(currentPage);

            }
        });

    });*/


</script>

<!--<script type="text/javascript">

    var vm8=new Vue({
        el:'.firstTr',
        data:{
            obj:[]
        }
    });

    function f() {
        
    }

</script>-->
</body>
</html>